﻿using Microsoft.AspNetCore.Identity;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;

namespace IService.Base
{
    public interface IBaseService<T>
    {
        /// <summary>
        /// 获取所有
        /// </summary>
        /// <param name="where"></param>
        /// <returns></returns>
        Task<List<T>> FindEntitiesAsync(Expression<Func<T, bool>> where);
        /// <summary>
        /// 根据Id获取单条记录
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        Task<T> FindByIdAsync(string id);
        /// <summary>
        /// 更新
        /// </summary>
        /// <param name="t"></param>
        /// <returns></returns>
        Task<IdentityResult> UpdateAsync(T t);
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="t"></param>
        /// <returns></returns>
        Task<IdentityResult> DeleteAsync(T t);
        /// <summary>
        /// 新增
        /// </summary>
        /// <param name="user"></param>
        /// <returns></returns>
        Task<IdentityResult> CreateAsync(T t);
    }
}
